package org.sc.learn.server.user.ctrl;

import org.sc.learn.server.user.entity.User;
import org.sc.learn.server.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author qianwx
 */
@RestController
@RequestMapping("user")
public class UserCtrl {

  @Autowired
  private UserService userService;

  @PostMapping("register")
  public User register(@RequestBody User user) {
    return userService.addUser(user);
  }

  @GetMapping("show")
  public String show() {
    return "hello";
  }
}
